simulation_full <- function(N, p = 0.1, phi = 0.1, theta = 0.1,
k = 0.5, alpha = 0.05, len = 1e4) {
# browser()
pip <- p * (1 - theta) + (1 - p) * phi
n <- 0.1 * N
M <- 0.9 * N
samples <- rerun(len, {
nprobs <- c((1 - p) * (1 - phi), (1 - p) * phi, p * theta, p * (1 - theta))
ns <- rmultinom(1, n, nprobs)
XY <- rmultinom(1, M, c(pip, 1 - pip))
tibble(
"n00" = ns[1], "n01" = ns[2], "n10" = ns[3],
"n11" = ns[4], "X" = XY[1], "Y" = XY[2]
)
}) %>% bind_rows()
list(
"counts" = c(
"N" = N,
"M" = M,
"n" = n,
"B" = len
),
"proportions" = c(
"p" = p,
"phi" = phi,
"theta" = theta,
"k" = k
),
"samples" = samples,
"intervals" = bind_cols(
# pmap_dfr(samples, ~mWald(..1, ..2, ..3, ..4, ..5, ..6, alpha)),
pmap_dfr(samples, ~intLik(..1, ..2, ..3, ..4, ..5, ..6, alpha)),
k %>%
map_dfc(
function(.k) pmap_dfr(samples, ~adj_intLik(..1, ..2, ..3, ..4, ..5, ..6, .k, alpha))
)
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.